/*************************************************
Description:智能家居--统计模块的实现
            温度统计、湿度统计、烟雾浓度统计
**************************************************/
#ifndef STATISTICWIDGET_H
#define STATISTICWIDGET_H

#include <QWidget>
#include <QVector>
#include "qcustomplot.h"


//class SqlHelp;

namespace Ui {
class StatisticWidget;
}

class StatisticWidget : public QWidget
{
    Q_OBJECT
    
public:
    explicit StatisticWidget(QWidget *parent = 0);
    ~StatisticWidget();

private slots:
    void realtimeDataSlot(); //添加实时数据的槽


    void on_checkBox_toggled(bool checked);

    void on_ckText_toggled(bool checked);

private:
    Ui::StatisticWidget *ui;
    QTimer dataTimer;
    int m_currentIndex;                       //当前界面id
    QList<QCustomPlot *> m_plots_list;

    QVector<double> m_plot_tempture_keys;
    QVector<QString> m_plot_tempture_labels;
    QVector<double> m_plot_tempture_values;
    QVector<double> m_plot_hum_keys;
    QVector<double> m_plot_hum_values;
    QVector<double> m_plot_smoke_values;
    QVector<double> m_plot_smoke_keys;
    int m_smoke_count;

    void initStyle();                       //初始化样式
    void initForm();                        //初始化界面
    void initPlot();                        //初始化绘图
    void initPlotTempture();                //初始化温度绘图
    void initPlotHumidity();                //初始化湿度绘图
    void initPlotSmoke();                   //初始化烟雾浓度绘图
    void initConnect();                     //初始化信号和槽连接

    //刷新界面数据
    void refreshTempture();
    void refreshHumidity();
    void refreshSmoke();

};

#endif // STATISTICWIDGET_H
